<?php
    
    if(!file_exists('settings.php'))
        include('settings.php');
    
?>

<html xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

        <script type="text/javascript">
            var trump_assets_url = "<?= $trump_assets_url ?>";
            var trump_canvas_url = "<?= $facebook_canvas_location ?>";
            var facebook_user_id = "<?= $user ?>";
        </script>
        
        <!-- JQuery includes -->
        <script type="text/javascript" src="<?= $trump_assets_url ?>js/jquery-1.4.4.min.js"></script>
        <script type="text/javascript" src="<?= $trump_assets_url ?>js/jquery-1.6.2.js"></script>
        
        <!-- Game JS includes -->
        <script type="text/javascript" src="<?= $trump_assets_url ?>js/trump.js"></script>
        
        <!-- Effects JS includes -->
	<script src="<?= $trump_assets_url ?>js/effects/ui/jquery.effects.core.js"></script>
	<script src="<?= $trump_assets_url ?>js/effects/ui/jquery.effects.explode.js"></script>
        <script src="<?= $trump_assets_url ?>js/effects/effects.js"></script>
        
        <!-- Game CSS includes -->
        <link rel="stylesheet" href="<?= $trump_assets_url ?>css/styles.css" type="text/css">
        
        <!-- Effects CSS includes -->
        <link rel="stylesheet" href="<?= $trump_assets_url ?>js/effects/themes/base/jquery.ui.all.css" type="text/css">
        
    </head>

    <body>
          
        <!-- Asynchronously Initialize JavaScript SDK with your app id, allowing you to 
           then make calls against the Facebook API -->
        <div id="fb-root"></div>

        <script type="text/javascript">

            if(window.top == window)
		top.location = '<? echo $facebook_canvas_location ?>'; 
                
            window.fbAsyncInit = function() 
            {
                FB.init(
                            {
                                appId: <?= $facebook_app_id ?>,
                                status: true,
                                cookie: true,
                                oauth : true,   //enables OAuth 2.0
                                xfbml  : true,  // parse XFBML
                                channelUrl : 'http://fbapp.vishaknag.com/includes/channel.html'
                            }
                        );

                FB.Canvas.setAutoResize();
                FB.XFBML.parse();
                
                FB.Event.subscribe('auth.login', function(response) {
                    top.location = '<? echo $facebook_canvas_location ?>'; 
                });
            };

            (function() 
                {
                    var e = document.createElement('script'); e.async = true;
                    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
                    document.getElementById('fb-root').appendChild(e);
                }()
            );

        </script> 